# # w write  写入  ---> 直接覆盖原内容
# with open("./files/lll.txt","w",encoding="utf-8") as f:
#    f.write('我是写入的内容')



# with open("./files/lll.txt","r",encoding="utf-8") as f:
#     print(f.read())


# 将原本的第二行修改为666
f = open("./files/lll.txt","r",encoding="utf-8") 
strl = f.read()
str2 = strl.replace('222','666')
f.close()


fw = open("./files/lll.txt","w",encoding="utf-8") 
fw.write(str2)
# flush  确认写入
fw.flush()

fr = open("./files/lll.txt","r",encoding="utf-8") 
print(fr.read())
fr.close()

